#include<stdio.h>

int DigitSum(unsigned int num)
{
	if (num > 9)
	{
		///num / 10
		/// print(1234)
		/// print(123)
		/// print(12) 
		/// print(1) 
		/// 1 2 3 4
		/// 
		///num % 10
		/// (4)
		/// (3)
		/// (2)
		/// (1)
		return DigitSum(num / 10) + num % 10;
	}
	else
	{
		return num;
	}
}


int main()
{
	unsigned int num = 0;
	scanf_s("%u", &num);
	int ret = DigitSum(num);
	printf("%d\n", ret);
	return 0;
}